<div class="popup_body">
    <div class="grid" style="width:715px; height:360px;">
        <table id="page_table_${pid}"></table>
    </div>
</div>
<div class="popup_btn">
    <button class="btn btn_red" id="ok_${pid}">确定</button>
    <button class="btn btn_border" id="close_${pid}">取消</button>
</div>
<script>
    (function() {
        var win = $('#${pid}'), windowData = win.data('windowData');
        var datagrid = $('#page_table_${pid}');
        datagrid.datagrid({
            fit: true,
            width: '100%',
            height: '100%',
            striped: true,
            pagination: true,
            url: "${contextPath}/security/hdw/cabinet/page.htm?agentId=${Session['SESSION_KEY_USER'].agentId}",
            fitColumns: true,
            pageSize: 10,
            pageList: [10, 50, 100],
            idField: 'id',
            singleSelect: true,
            selectOnCheck: false,
            checkOnSelect: false,
            autoRowHeight: false,
            rowStyler: gridRowStyler,
            columns: [
                [
                    {field: 'checkbox', checkbox: true },
                    {
                        title: '名称',
                        align: 'center',
                        field: 'cabinetName',
                        width: 40
                    },
                    {
                        title: '地址',
                        align: 'center',
                        field: 'address',
                        width: 60,
                        formatter: function(val, row) {
                            return (row.provinceName || '') + (row.cityName || '') + (row.districtName || '') + (row.street || '');
                        }
                    }
                ]
            ],
            onLoadSuccess:function(row){
                $('#page_table').datagrid('clearChecked');
                $('#page_table').datagrid('clearSelections');
                var list = row.rows;
                for(var i = 0; i < list.length; i++) {
                    var index = datagrid.datagrid('getRowIndex', list[i]);
                    if(index >= 0) {
                        datagrid.datagrid('checkRow', index);
                    }
                }
            }
        });


        $('#close_${pid}').click(function() {
            win.window('close');
        });

    })()
</script>